<template>
	<view class="main">
		<view class="active_tit">
			<view class="tit">
				客户信息
			</view> 
		</view>
		<!-- input -->
		<ActiveForm  ref='custName'>
			<view class="active_label">
				申请人姓名：
			</view>
			<view class="active_input">
				<input :disabled="isdisabled" type="text" v-model.trim="stdOffsurIndBasic.custName" />
			</view>
		</ActiveForm>
		
		<ActiveForm required ref='idType'>
			<view class="active_label">
				申请人证件类型：
			</view>
			<view class="active_input">
				<SelectPicker :disabled="isdisabled" v-model="stdOffsurIndBasic.idType" :options="maritalIdTypeOptions" placeholder="请选择" />
			</view>
		</ActiveForm>
		<ActiveForm required  ref='idCode'>
			<view class="active_label">
				申请人证件号码：
			</view>
			<view class="active_input">
				<input :disabled="isdisabled" type="text" @input="cardCheck" v-model.trim="stdOffsurIndBasic.idCode"  maxlength="18" />
			</view>
		</ActiveForm>
		<ActiveForm required  ref='custEducation'>
			<view class="active_label">
				申请人学历：
			</view>
			<view class="active_input">
					<SelectPicker v-model="stdOffsurIndBasic.custEducation" :options="educationOptions" placeholder="请选择" />
			</view>
		</ActiveForm>

		<ActiveForm required  ref='telephone'>
			<view class="active_label">
				申请人手机号码：
			</view>
			<view class="active_input">
				<input type="text" @input="numCheck2" v-model.trim="stdOffsurIndBasic.telephone" maxlength="11" />
			</view>
		</ActiveForm>
		
		<ActiveForm required  ref='address'>
			<view class="active_label">
				申请人家庭地址：
			</view>
			<view class="active_input">
				<input type="text" v-model="stdOffsurIndBasic.address" />
				<!-- <RegionPicker :value="address(stdOffsurIndBasic.address)"  :options="region"  @change="((o)=>{stdOffsurIndBasic.address=o.value.toString()})"    /> -->	
			</view>
		</ActiveForm>
		<ActiveForm required  ref='addDetail'>
			<view class="active_label">
				申请人家庭详细地址：
			</view>
			<view class="active_input">
				<input type="text" v-model="stdOffsurIndBasic.addDetail" />
			</view>
		</ActiveForm>
		<ActiveForm required  ref='maritalStatus'>
			<view class="active_label">
				申请人婚姻状况：
			</view>
			<view class="active_input">
				<SelectPicker v-model="stdOffsurIndBasic.maritalStatus" :options="maritalStatusOptions" placeholder="请选择" @change='maritalStatusChange' />
			</view>
		</ActiveForm>
		<ActiveForm   ref='otherIncomeYear'>
			<view class="active_label">
				其他年收入(元)：
			</view>
			<view class="active_input">
				<mInput type="text" v-model="stdOffsurIndBasic.otherIncomeYear" />
			</view>
		</ActiveForm>
		<ActiveForm   ref='email'>
			<view class="active_label">
				邮箱：
			</view>
			<view class="active_input">
				<input placeholder="此邮箱用于电子合同送达。" type="text" v-model="stdOffsurIndBasic.email" />
			</view>
		</ActiveForm>
		
		
	</view>
</template>

<script>
	import SelectPicker from "../../SelectPicker";
	import RegionPicker from "../../RegionPicker";
	import region from '../areaList.js'
	export default {
		name: 'userInfo',
		data() {
			return {
				ideyAttributeOption:[],
				isdisabled:false,
				region,
				province: "",
				city: "",
				county: "",
				index: 1,
				stdOffsurIndBasic: {
					addDetail: "", //借款人家庭详细住址
					address: '1,2,3', //借款人家庭住址
					businessId: "", //业务申请流水号
					carMortgage: "", //是否办理商用车按揭
					createTime: "", //创建时间
					createUser: "", //创建人
					custAge: 0, //借款人年龄
					custEducation: "", //借款人学历
					custName: "", //借款人姓名
					customerId: "", //客户编号
					customerSystemId: "", //客户系统编号
					deleteFlag: "", //删除标志
					entName: "", //企业名称
					entityRoleType: "", //数据归属类型
					famNumber: 0, //借款人家庭人数
					getDatTime: "", //数据加载时间
					idCode: "", //借款人证件号码
					idType: "", //借款人证件类型
					imageUrl: "", //影像路径
					liveCondition: "", //借款人居住情况
					localYears: 0, //借款人本地居住年限
					mar12monthIncome: 0, //配偶近12个月收入（元）
					maritalIdCode: "", //配偶证件号码
					maritalIdType: "", //配偶证件类型
					maritalName: "", //借款人配偶姓名
					maritalOrg: "", //配偶单位名称
					maritalStatus: "", //借款人婚姻状况
					maritalTelephone: "", //配偶手机号码
					maritalVocation: "", //配偶职业
					month12Income: 0, //借款人近12个月收入
					reqId: "", //业务申请序号
					sourceSystem: "", //数据来源系统
					telephone: "", //借款人手机号码
					updateTime: "", //更新时间
					updateUser: "", //更新人
					uuid: "" //uuid
				},
				maritalIdTypeOptions: [],
				vocationOptions: [],
				maritalStatusOptions: [],
				educationOptions:[],
				liveConditionOptions:[],
				required:false
			}
		},
		components: {
			SelectPicker,
			RegionPicker

		},
		computed:{
			address(){
				return function(val){
					//debugger
				        if(val==''||val==null){
				        	return []
				        }else{
				        	return val.split(",")
				        }
				      }
			}
		},
		mounted() {
			//获取返显数据
			setTimeout(()=>{
				this.ideyAttributeOption = getApp().globalData.optType.IDEN_ATT_GR //自然人
				
				//获取下拉类型
				this.stdOffsurIndBasic = getApp().globalData.stdOffsurIndBasic
				this.isdisabled = getApp().globalData.indDisabled
				this.maritalStatusOptions = getApp().globalData.optType.MARITAL
				this.educationOptions = getApp().globalData.optType.EDU
				this.maritalIdTypeOptions = getApp().globalData.optType.IDENT
				this.liveConditionOptions = getApp().globalData.optType.LIVE
				this.vocationOptions = getApp().globalData.optType.VOCATIO
				
			},getApp().globalData.timeout)
		},
		watch:{
			stdOffsurIndBasic:{
				handler:function(res){
					//console.warn('stdOffsurIndBasic组件数据变化',res)
					getApp().globalData.stdOffsurIndBasic = res
				},
				deep:true
			}
		},
		methods:{
			onBlur(item,name){
				if(!this.checkIDCard(this.stdOffsurIndBasic.maritalIdCode)){
					this.stdOffsurIndBasic.maritalIdCode = ''
					uni.showToast({
						    icon:'none',
							title: '身份证号码无效,请重新输入！',
							duration: 2500
						});
				}
			},
			cardCheck(e){
				setTimeout(()=>{
					this.stdOffsurIndBasic.idCode = e.target.value.replace(/[^\a-\z\A-\Z0-9]/g,'')
				},50)
			},
			cardCheck2(e){
				setTimeout(()=>{
					this.stdOffsurIndBasic.maritalIdCode = e.target.value.replace(/[^\a-\z\A-\Z0-9]/g,'')
				},50)
			},
			numCheck(e){
				//console.log(e)
				setTimeout(()=>{
					this.stdOffsurIndBasic.maritalTelephone = e.target.value.replace(/[^0-9]/g,'')
				},50)
			},
			numCheck2(e){
				setTimeout(()=>{
					this.stdOffsurIndBasic.telephone = e.target.value.replace(/[^0-9]/g,'')
				},50)
			},
			maritalStatusChange(){
				
			}
		}
	}
</script>

<style lang="scss">
	
	
</style>
